<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>卡片切换原型</title>
  <style>
    body {
      margin: 0;
      padding: 0;
      font-family: sans-serif;
      background-color: #f8f8f8;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding-top: 85px;
    }

    .card-stack {
      position: relative;
      width: 320px;
      height: 400px;
    }

    .card {
      position: absolute;
      width: 100%;
      height: 100%;
      background: #fff;
      border-radius: 20px;
      box-shadow: 0 4px 10px rgba(0,0,0,0.1);
      padding: 45px 20px 80px 20px;
      box-sizing: border-box;
      transition: transform 0.5s ease, z-index 0s;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
    }

    .card h4 {
      font-size: 14px;
      margin: 0;
    }

    .card p {
      margin-top: 20px;
      font-size: 18px;
      line-height: 1.5;
    }

    .card-button {
      position: absolute;
      bottom: -25px;
      left: 50%;
      transform: translateX(-50%);
      width: 50px;
      height: 50px;
      background: white;
      border: 2px solid black;
      border-radius: 50%;
      font-size: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      z-index: 100;
    }

    .launch-button {
      margin-top: 212px;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 16px;
      padding: 10px 20px;
      border: 1.5px solid black;
      border-radius: 12px;
      background-color: white;
      cursor: pointer;
    }

    .launch-button::before {
      content: "+";
      font-size: 20px;
    }

    /* 卡片位置错开样式 */
    .card.back {
      transform: translateY(20px) scale(0.94);
      z-index: 0;
    }

    .card.middle {
      transform: translateY(10px) scale(0.97);
      z-index: 1;
    }

    .card.front {
      transform: translateY(0px) scale(1);
      z-index: 2;
    }

  </style>
</head>
<body>

<div class="card-stack">
  <div class="card front">
    <h4>Did you know?</h4>
    <p>The very first Doodle launched as an “out of office” message when Larry and Sergey went on vacation.</p>
  </div>
  <div class="card middle">
    <h4>Did you know?</h4>
    <p>Google's name originated from a misspelling of the word "googol," a very large number.</p>
  </div>
  <div class="card back">
    <h4>Did you know?</h4>
    <p>The first Google server was made from LEGO bricks and used in a student dorm room.</p>
  </div>
  <div class="card-button" onclick="nextCard()">➤</div>
</div>

<button class="launch-button">发起拉钩</button>

<script>
  const cards = document.querySelectorAll('.card');
  let order = [0, 1, 2]; // 当前顺序：front, middle, back

  function applyClasses() {
    cards[order[0]].className = 'card front';
    cards[order[1]].className = 'card middle';
    cards[order[2]].className = 'card back';
  }

  function nextCard() {
    order.push(order.shift()); // 移动第一个到最后一个
    applyClasses();
  }

  applyClasses(); // 初始调用
</script>

</body>
</html>
